import sqlite3
import time

conn = sqlite3.connect('../database.db')
conn.row_factory = sqlite3.Row

# cursor = conn.cursor()
# sql = "create index device_index_? on gate_pass_info_device_?(secret_card)"
# l = []
# for i in range(0, 1):
#     l.append([i, i])
# #
# conn.executemany(sql, l)

for i in range(5, 806):
    start_time = time.time()
    table_name = 'gate_pass_info_device_{}'.format(i)
    sql = "create index device_index_{} on {}(device)".format(i, table_name)
    result = conn.execute(sql)
    print('{} create index'.format(table_name))
    end_time = time.time()
    print('process time is {}'.format(end_time - start_time))

conn.commit()
